home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Gooey1.3.1 / C++ Templates / mmModelessDialog.c < prev    next >
Text File  |  1994-04-16  |  19KB  |  582 lines

  1. $$Loop ModelessDialogs
  2. $$Message MM Modeless Dialog, mm:mmMD_$Worksheet.name$.cp
  3.  
  4. $$File mm:mmMD_$Worksheet.name$.cp
  5. /*  mmMD_$Worksheet.name$                                 Handle this dialog */
  6. /*  $CopyRight$ */
  7.  
  8. /*    File name:  mmMD_$Worksheet.name$.c
  9.     Function:  Handle this modeless dialog.
  10.  
  11.     This dialog is called when:
  12.  
  13.     History: $Date$ Original by $Author$
  14.  
  15. */
  16.  
  17. #include "mmCommon$Prototype.name$.h"    /* Common */
  18. #include "Common$Prototype.name$.h"        /* Common */
  19.  
  20. /* ======================================================= */
  21. /* ======================================================= */
  22.  
  23. /* Routine: Init */
  24. /* Purpose: This procedures purpose is to set the window pointer to nil, */
  25. /* this is used to tell the other routines */
  26.  
  27. void CmmMD$Worksheet.name$::Init()
  28. {
  29.  
  30.  
  31. inherited::Init();
  32.  
  33. $$Loop Control.type = Button
  34. this->Enable_$Control.name$ = $Control.Active$;            /* Button */
  35. $$EndLoop
  36. $$Loop Control.type = HotRect
  37. $$if Control.HotSpot
  38. this->Enable_$Control.name$ = $Control.Active$;            /* HotSpot */
  39. $$endif
  40. $$EndLoop
  41. $$Loop Control.type = Checkbox
  42. this->Enable_$Control.name$ = $Control.Active$;            /* Checkbox */
  43. $$if Control.Selected
  44. this->Value_$Control.name$ = 1;
  45. $$endif
  46. $$if Control.Unselected
  47. this->Value_$Control.name$ = 0;
  48. $$endif
  49. $$EndLoop
  50. $$Loop Control.type = Radio
  51. this->Enable_$Control.name$ = $Control.Active$;            /* Radio */
  52. $$if Control.Selected
  53. this->Value_$Control.name$ = 1;
  54. $$endif
  55. $$if Control.Unselected
  56. this->Value_$Control.name$ = 0;
  57. $$endif
  58. $$EndLoop
  59. $$Loop Control.type = ScrollBar
  60. this->Enable_$Control.name$ = $Control.Active$;            /* ScrollBar */
  61. this->Value_$Control.name$ = $Control.ValueScroll$;
  62. $$EndLoop
  63. $$Loop Control.type = Icon
  64. this->Enable_$Control.name$ = $Control.Active$;            /* Icon button */
  65. $$EndLoop
  66. $$Loop Control.type = Sicn
  67. this->Enable_$Control.name$ = $Control.Active$;            /* Sicn button */
  68. $$EndLoop
  69. $$Loop Control.type = Picture
  70. $$if Control.NonGraphic
  71. this->Enable_$Control.name$ = $Control.Active$;            /* Picture button */
  72. $$endif
  73. $$EndLoop
  74. $$Loop Control.type = UButton
  75. this->Enable_$Control.name$ = $Control.Active$;            /* Plugin button */
  76. $$EndLoop
  77. $$Loop Control.type = UToggle
  78. this->Enable_$Control.name$ = $Control.Active$;            /* Plugin toggle */
  79. $$if Control.Selected
  80. this->Value_$Control.name$ = 1;
  81. $$endif
  82. $$if Control.Unselected
  83. this->Value_$Control.name$ = 0;
  84. $$endif
  85. $$EndLoop
  86. $$Loop Control.type = UGauge
  87. this->Enable_$Control.name$ = $Control.Active$;            /* Plugin gauge */
  88. this->Value_$Control.name$ = $Control.ValueScroll$;
  89. $$EndLoop
  90. $$Loop Control.type = Popup
  91. this->Enable_$Control.name$ = $Control.Active$;            /* Popup menu */
  92. this->Value_$Control.name$ = $Control.SelectedID$;
  93. $$EndLoop
  94. $$Loop Control.type = Palette
  95. this->Enable_$Control.name$ = $Control.Active$;            /* Palette */
  96. this->Value_$Control.name$ = $Control.ValueScroll$;
  97. $$EndLoop
  98. $$Loop Control.type = List
  99. this->List_$Control.name$ = nil;                            /* List */
  100. SetRect(&this->ListRect_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);        /* left,top,right,bottom */
  101. $$EndLoop
  102. $$Loop Control.type = EditText
  103. this->TE_$Control.name$ = nil;                            /* Edit Text */
  104. SetRect(&this->TERect_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);        /* left,top,right,bottom */
  105. GetIndString(this->TEStr_$Control.name$,sResD_$Control.name$,1);/*  ...Edit text, default value  */
  106. $$EndLoop
  107. }
  108.  
  109. /* ======================================================= */
  110.  
  111. /* Routine: Update */
  112. /* Purpose: This procedures purpose is to refresh this window, update it, */
  113. /* when we are uncovered by another window.  */
  114.  
  115. void CmmMD$Worksheet.name$::Update(WindowPtr theWindow)
  116. {
  117. GrafPtr    SavedPort;                                /* Save the current port so we can restore to it */
  118. Rect    tempRect;                                    /* Temporary rectangle variable */
  119. Rect    rTempRect;                                    /* Temporary rectangle variable */
  120. short    DType;                                    /* Type of dialog item */
  121. Handle    DItem;                                    /* Handle to the dialog item */
  122. ControlHandle    CItem;                            /* Control handle */
  123. RGBColor    Saved_ForeColor;                        /* Place to save colors */
  124. RGBColor    Saved_BackColor;                        /* Place to save colors */
  125.  
  126.  
  127. if ((this->theWindow != nil) && (theWindow == this->theWindow))/* Only do if we are the window to update */
  128.     {
  129.     GetPort(&SavedPort);                            /* Get the current port */
  130.     SetPort(theWindow);                            /* Point to our port for drawing in our window */
  131.     if (Has.ColorQD)                                /* See if color QuickDraw is around */
  132.         {
  133.         GetForeColor(&Saved_ForeColor);            /* Save the fore color */
  134.         GetBackColor(&Saved_BackColor);            /* Save the back color */
  135.  
  136.         RGBForeColor(&Black_ForeColor);            /* Set the fore color to Black */
  137.         RGBBackColor(&White_BackColor);            /* Set the back color to White */
  138.         }                                        /* End of IF */
  139.  
  140. $$Loop Control.type = Button
  141. $$if Control.Default
  142.     /* This is the default selection, when RETURN is pressed. */
  143.     HiliteDefaultButton(theWindow,ResD_$Control.name$);
  144.  
  145. $$endif Control.Default
  146. $$EndLoop Control.type
  147. $$Loop Control.type = Line
  148.     /* Draw a line, $Control.FullName$ */
  149. $$if Control.GrayLine
  150.     PenPat(qd.gray);                                        /* Set the gray pen pattern */
  151. $$endif Control.GrayLine
  152. $$if Control.LineWidth ! 1
  153.     PenSize($Control.LineWidth$,$Control.LineWidth$);
  154. $$endif Control.LineWidth
  155.     MoveTo($Control.LeftPosition$,$Control.TopPosition$);        /* Horz,vert, Move to starting position */
  156.     LineTo($Control.RightPosition$,$Control.BottomPosition$);    /* Horz,vert, Draw to the ending position */
  157. $$if Control.LineWidth ! 1
  158.     PenSize(1,1);
  159. $$endif Control.LineWidth
  160. $$if Control.GrayLine
  161.     PenPat(qd.black);                                        /*  Back to default pen pattern  */
  162. $$endif Control.GrayLine
  163.  
  164. $$EndLoop
  165. $$Loop Control.type = StaticText
  166. $$if Control.SpecialText
  167.     /* Draw static text, $Control.FullName$ */
  168. $$if Control.TextColor ! Black
  169.     if (Has.ColorQD)                                        /* See if color QuickDraw is around */
  170.         {
  171.         DrawingColor.red = 0x$Control.RedTextColor$;
  172.         DrawingColor.green = 0x$Control.GreenTextColor$;
  173.         DrawingColor.blue = 0x$Control.BlueTextColor$;
  174.         RGBForeColor(&DrawingColor);                    /* Set the fore color */
  175.         RGBBackColor(&Saved_BackColor);                    /* Set the back color */
  176.         }
  177. $$endif Control.TextColor
  178.     $$if Control.MultipleLine
  179.     SetRect(&tempRect,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);
  180.     DrawStaticTextBox(sResD_$Control.name$,&tempRect,$Control.TextAlignment$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
  181.     $$endif Control.MultipleLine
  182.     $$if Control.SingleLine
  183.     DrawStaticLine(sResD_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
  184.     $$endif Control.SingleLine
  185. $$if Control.TextColor ! Black
  186.     if (Has.ColorQD)                                        /* See if color QuickDraw is around */
  187.         {
  188.         RGBForeColor(&Black_ForeColor);                    /* Set the fore color */
  189.         RGBBackColor(&White_BackColor);                    /* Set the back color */
  190.         }
  191. $$endif Control.TextColor
  192.  
  193. $$endif Control.SpecialText
  194. $$EndLoop
  195. $$Loop Control.type = List
  196.     UpdateTheList(theWindow->visRgn,this->List_$Control.name$,&this->ListRect_$Control.name$,
  197.         $Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  198.  
  199. $$EndLoop
  200.     TextSize(12);
  201.     TextFont(systemFont);                                /* Select the Font that we want */
  202.     TextFace(0);                                        /* Select the style that we want */
  203.  
  204.     if (Has.ColorQD)                                    /* See if color QuickDraw is around */
  205.         {
  206.         RGBForeColor(&Saved_ForeColor);                    /* Restore the fore color */
  207.         RGBBackColor(&Saved_BackColor);                    /* Restore the back color */
  208.         }
  209.  
  210.     this->UpdateExtras();                        /* HOOK, allow user update code */
  211.     
  212.     DrawDialog(theWindow);                        /* Draw the rest of the controls */
  213.     SetPort(SavedPort);                            /* Restore the port that we saved at the start */
  214.     }
  215. }
  216.  
  217. /* ======================================================= */
  218.  
  219. /* Routine: Open */
  220. /* Purpose: This procedures purpose is to open this window and set all */
  221. /* of the initial conditions, such as default edit text. */
  222.  
  223. void CmmMD$Worksheet.name$::Open()
  224. {
  225. Rect            tempRect;                            /* Temporary rectangle variable */
  226. short            DType;                                /* Type of dialog item */
  227. Handle            DItem;                                /* Handle to the dialog item */
  228. ControlHandle    CItem;                                /* Control handle */
  229. long            LTemp,LTemp2,theLong;                /* Get selection, temp holding */
  230. DialogPtr        theDialog;
  231.  
  232.  
  233. if (this->theWindow == NIL)
  234.     {
  235.     this->theWindow = GetNewDialog(ResD_$Worksheet.name$,NIL,(WindowPtr)-1 );/* Bring in the dialog resource */
  236.     theDialog = this->theWindow;
  237.     SetPort(theDialog);                /* Prepare to add conditional text */
  238.  
  239.     $$if Worksheet.Center
  240.     tempRect = theDialog->portRect;            /* Get the windows position and size */
  241.     $$if Worksheet.CenterHorz
  242.     tempRect.left = ((screenRect.bounds.right - screenRect.bounds.left) - (tempRect.right - tempRect.left)) / 2;    /* Center Horz */
  243.     $$endif Worksheet.CenterHorz
  244.     $$if Worksheet.CenterVert
  245.     tempRect.top = ((screenRect.bounds.bottom - screenRect.bounds.top) - (tempRect.bottom - tempRect.top)) / 3;    /* 1/3 vert */
  246.         if (tempRect.top < 40)                            /* Keep below the menu bar */
  247.         tempRect.top = 40;
  248.     $$endif Worksheet.CenterVert
  249.     MoveWindow(theDialog,tempRect.left,tempRect.top,true);
  250.     
  251.     $$endif
  252. $$if ModelessDialog.Movable
  253.     Doing_MovableModal = true;
  254.     
  255. $$endif ModelessDialog.Movable
  256. $$Loop Control.type = Button
  257.     /* Button */
  258.     SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,0);
  259.  
  260. $$EndLoop Control.type
  261. $$Loop Control.type = Checkbox
  262.     /* Checkbox */
  263.     SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,this->Value_$Control.name$);
  264.  
  265. $$EndLoop Checkbox
  266. $$Loop Control.type = Radio
  267.     /* Radio button */
  268.     SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,this->Value_$Control.name$);
  269.  
  270. $$EndLoop Radio
  271. $$Loop Control.type = List
  272.     /* Make a List */
  273.     Make_A_List(&this->List_$Control.name$,&this->ListRect_$Control.name$,
  274.         theDialog,sResD_$Control.name$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  275.  
  276. $$EndLoop
  277. $$Loop Control.type = HotRect
  278.     /* Draw a Hotspot or Rectangle */
  279.     SetupHotSpot(theDialog,ResD_$Control.name$,$Control.MakeHotSpot$,$Control.LineWidth$,
  280.         $Control.ShadowWidth$,sResD_$Control.name$,this->Enable_$Control.name$);
  281.  
  282. $$EndLoop
  283. $$Loop Control.type = EditText
  284.     GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get the item handle */
  285.     GetIndString(sTemp,sResD_$Control.name$,1);            /* ...Edit text, default value */
  286.     SetIText(DItem,sTemp);                                /* Set the default text string */
  287.     SelIText(theDialog,ResD_$Control.name$,0,300);
  288.  
  289. $$EndLoop
  290. $$Loop Control.type = Popup
  291.     SetupPopupMenu(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  292.         mResD_$Control.name$,this->Value_$Control.name$);
  293.  
  294. $$EndLoop
  295. $$Loop Control.type = Picture
  296. $$if Control.NonGraphic
  297.     /* Draw a picture */
  298.     LTemp = ResD_N_$Control.name$;                        /* Picture ID and resize flag */
  299. $$if Control.ClipPicture
  300.     LTemp = 0x00010000 | LTemp;
  301. $$endif Control.ClipPicture
  302.     SetupTheItem(theDialog,ResD_$Control.name$,true,true,
  303.         this->Enable_$Control.name$,false,&tempRect,LTemp,0);
  304.  
  305. $$endif Control.NonGraphic
  306. $$EndLoop
  307. $$Loop Control.type = Palette
  308.     /* Draw a Palette */
  309.     SetupPalette(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  310.         $Control.NumRows$,$Control.NumColumns$,ResD_N_$Control.name$,$Control.HMethod$);
  311.  
  312. $$EndLoop
  313. $$Loop Control.type = Icon
  314. $$if Control.NonGraphic
  315.     /* Draw an Icon button */
  316.     SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  317.         ResD_N_$Control.name$,ResD_H_$Control.name$);
  318.  
  319. $$endif Control.NonGraphic
  320. $$EndLoop
  321. $$Loop Control.type = Sicn
  322.     /* Draw a Sicn */
  323. $$if Control.Graphic
  324.     SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  325.         ResD_N_$Control.name$,ResD_N_$Control.name$);
  326. $$endif Control.Graphic
  327. $$if Control.NonGraphic
  328.     SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  329.         ResD_N_$Control.name$,ResD_H_$Control.name$);
  330. $$endif Control.NonGraphic
  331.  
  332. $$EndLoop
  333. $$Loop Control.type = UButton
  334.     SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  335.         ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  336.  
  337. $$EndLoop
  338. $$Loop Control.type = UToggle
  339.     SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  340.         ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  341.  
  342. $$EndLoop
  343. $$Loop Control.type = UGauge
  344.     SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  345.         ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  346.     SetupMinMaxValue(theDialog,ResD_$Control.name$,$Control.MinScroll$,$Control.MaxScroll$,this->Value_$Control.name$);
  347.  
  348. $$EndLoop
  349. $$Loop Control.type = ScrollBar
  350.     SetupTheItem(theDialog,ResD_$Control.name$,true,true,this->Enable_$Control.name$,true,&tempRect,0,0);
  351.     SetupMinMaxValue(theDialog,ResD_$Control.name$,$Control.MinScroll$,$Control.MaxScroll$,this->Value_$Control.name$);
  352.  
  353. $$EndLoop
  354.  
  355.     $$Link    Worksheet.Open
  356.  
  357.     this->OpenExtras();                    /* Call the user Open procedure */
  358.  
  359.     ShowWindow(theDialog);                /* Open a dialog box */
  360.     SelectWindow(theDialog);            /* Lets see it */
  361.     }
  362. else
  363.     SelectWindow(this->theWindow);        /* Lets see it */
  364. }
  365.  
  366. /* ======================================================= */
  367.  
  368. /* Routine: Close_$Worksheet.name$ */
  369. /* Purpose: This procedures purpose is to close this window and clear */
  370. /* the window pointer variable */
  371.  
  372. void CmmMD$Worksheet.name$::Close(WindowPtr theWindow)
  373. {
  374. Rect    tempRect;                                    /* Temporary rectangle */
  375. short    DType;                                        /* Type of dialog item */
  376. Handle    DItem;                                        /* Handle to the dialog item */
  377.  
  378.  
  379. if ((this->theWindow != NIL) && (theWindow == this->theWindow))/* Only close if it is us and we were open */
  380.     {
  381.     $$Link    Worksheet.Close
  382.  
  383. $$if ModelessDialog.Movable
  384.     Doing_MovableModal = false;
  385.     
  386. $$endif ModelessDialog.Movable
  387.     DisposDialog(theWindow);                        /* Close on the screen and Flush the dialog out of memory */
  388.     this->theWindow = nil;                            /* Make sure our other routines know that we are closed */
  389.     }
  390. }
  391.  
  392. /* ======================================================= */
  393.  
  394. /* Routine: HandleEvent */
  395. /* Purpose: This procedures purpose is to handle all actions, such as buttons being pressed. */
  396. /* This is the real meat of this unit and is where the code is for acting upon the users actions. */
  397.  
  398. void CmmMD$Worksheet.name$::HandleEvent(EventRecord *theEvent,WindowPtr theWindow,short itemHit)
  399. {
  400. short    Index;                                        /* For looping */
  401. Point    myPt;                                        /* For the local mouse position */
  402. short    DType;                                        /* Type of dialog item */
  403. Handle    DItem;                                        /* Handle to the dialog item */
  404. Rect    tempRect;                                    /* Temporary rectangle */
  405. ControlHandle    CItem;                                /* Control handle */
  406. short    temp;                                        /* temp integer */
  407. short    code;                                        /* temp integer */
  408. short    theSelection;                                /* For Palettes */
  409. Boolean    DoubleClick;                                /* For sensing double clicks in a list */
  410. DialogPtr        theDialog;
  411.  
  412.  
  413. this->ExitDialog = false;                    /* Do not close the dialog yet */
  414. $$if HasLists
  415. if ((theEvent->what == mouseDown) && (this->theWindow != nil))
  416.     {
  417.     SetPort(this->theWindow);                    /* Set the port to our dialog */
  418.     myPt = theEvent->where;                            /* Get the position where the mouse was pressed */
  419.     GlobalToLocal(&myPt);                            /* Change from global to local location */
  420.  
  421.     $$Loop Control.type = List
  422.     if (PtInRect(myPt,&this->ListRect_$Control.name$))
  423.         ClickInTheList(myPt,theEvent->modifiers,this->List_$Control.name$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  424.  
  425.     $$EndLoop Control.type
  426.     }
  427. $$endif HasLists
  428.  
  429. if ((this->theWindow != nil)  && (this->theWindow  == theWindow))
  430.     {
  431.     theDialog = this->theWindow;
  432.     
  433.     CheckKeysInDialog(theDialog,&DoubleClick,theEvent,&itemHit);
  434.  
  435.     myPt = theEvent->where;                            /* Get the position where the mouse was pressed */
  436.     GlobalToLocal(&myPt);                            /* Change from global to local location */
  437.  
  438.     this->FilterTheHit(&itemHit,theEvent);            /* Give the user the itemhit */
  439.  
  440.     if (itemHit > 0)                                /* Skip if user set to zero */
  441.         {
  442.         GetDItem(theDialog,itemHit,&DType,&DItem,&tempRect);/* Get which item was pressed */
  443.         CItem = (ControlHandle)DItem;                /* Change the pointer for getting to the control */
  444.         }
  445.     
  446.     /* Handle it real time */
  447.     $$Loop Control.type = Button
  448.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  449.         {
  450.         $$Link    Control.Select
  451.         $$if Control.ExitDialog
  452.         this->ExitDialog = true;                    /* Close this dialog, exit */
  453.         $$endif Control.ExitDialog
  454.         }
  455.  
  456.     $$EndLoop Control.type
  457.     $$Loop Control.type = Checkbox
  458.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  459.         {
  460.         temp = GetCtlValue(CItem);                    /* Get the current Checkbox value */
  461.         SetCtlValue(CItem, (temp + 1) & 1);            /* Toggle the value to the opposite */
  462.         this->Value_$Control.name$ = GetCtlValue(CItem);    /* Get the current Checkbox value */
  463.         $$if Control.HasLinks
  464.         if (this->Value_$Control.name$ == 0)
  465.             {
  466.             $$Link    Control.Deselect
  467.             }
  468.         else
  469.             {
  470.             $$Link    Control.Select
  471.             }
  472.         $$endif
  473.         }
  474.  
  475.     $$EndLoop Control.type
  476.     $$Loop Control.type = UButton
  477.     $$if Control.HasLinks
  478.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  479.         {
  480.         $$Link    Control.Select
  481.         }
  482.  
  483.     $$endif
  484.     $$EndLoop Control.type
  485.     $$Loop Control.type = UToggle
  486.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  487.         {
  488.         temp = GetCtlValue(CItem);                    /* Get the current Checkbox value */
  489.         SetCtlValue(CItem, (temp + 1) & 1);            /* Toggle the value to the opposite */
  490.         this->Value_$Control.name$ = GetCtlValue(CItem);    /* Get the current Checkbox value */
  491.         $$if Control.HasLinks
  492.         if (this->Value_$Control.name$ == 0)
  493.             {
  494.             $$Link    Control.Deselect
  495.             }
  496.         else
  497.             {
  498.             $$Link    Control.Select
  499.             }
  500.         $$endif
  501.         }
  502.  
  503.     $$EndLoop Control.type
  504.     $$Loop Control.type = Radio
  505.     if (itemHit == ResD_$Control.name$)            /* Handle the Radio being pressed */
  506.         {
  507.         SetCtlValue(CItem,1);
  508.         this->Value_$Control.name$ = 1;    /* Set the current Radio value */
  509.  
  510.         $$Loop RadioGroup
  511.         ClearTheRadio(theDialog,ResD_$Control.name$,&this->Value_$Control.name$);
  512.         $$EndLoop RadioGroup
  513.         $$Link    Control.Select
  514.         }
  515.  
  516.     $$EndLoop Control.type
  517.     $$Loop Control.type = HotRect
  518.     $$if Control.HotSpot
  519.     $$if Control.HasLinks
  520.     if (itemHit == ResD_$Control.name$)                /* Handle the HotSpot being pressed */
  521.         {
  522.         $$Link    Control.Select
  523.         }
  524.  
  525.     $$endif
  526.     $$endif Control.HotSpot
  527.     $$EndLoop
  528.     $$Loop Control.type = Popup
  529.     /* Popup */
  530.  
  531.     $$EndLoop
  532.     $$Loop Control.type = Picture
  533.     $$if Control.NonGraphic
  534.     $$if Control.HasLinks
  535.     if (itemHit == ResD_$Control.name$)                /* Handle the Picture being pressed */
  536.         {
  537.         $$Link    Control.Select
  538.         }
  539.  
  540.     $$endif
  541.     $$endif Control.NonGraphic
  542.     $$EndLoop
  543.     $$Loop Control.type = Palette
  544.     /* Palette */
  545.  
  546.     $$EndLoop
  547.     $$Loop Control.type = Icon
  548.     $$if Control.NonGraphic
  549.     $$if Control.HasLinks
  550.     if (itemHit == ResD_$Control.name$)                /* Handle the Icon being pressed */
  551.         {
  552.         $$Link    Control.Select
  553.         }
  554.  
  555.     $$endif
  556.     $$endif Control.NonGraphic
  557.     $$EndLoop
  558.     $$Loop Control.type = Sicn
  559.     $$if Control.NonGraphic
  560.     $$if Control.HasLinks
  561.     if (itemHit == ResD_$Control.name$)                /* Handle the Sicn being pressed */
  562.         {
  563.         $$Link    Control.Select
  564.         }
  565.  
  566.     $$endif
  567.     $$endif Control.NonGraphic
  568.     $$EndLoop
  569.  
  570.     }
  571.  
  572. if (this->ExitDialog)                        /* Do the close of the dialog */
  573.     this->Close(this->theWindow);
  574. }
  575.  
  576. /* ======================================================= */
  577. /* ======================================================= */
  578. $$CloseFile
  579. $$EndLoop
  580.  
  581.  
  582.